package com.yima.baseproj.module.app.equipmentDevice;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yima.baseproj.module.app.equipmentDevice.model.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
public class EquipmentDeviceService extends ServiceImpl<EquipmentDeviceMapper, EquipmentDeviceEntity> {

    public Page<Map> findByPage(Page page, EquipmentDeviceSearchModel searchVo) {
        return baseMapper.findBySearchVo(page, searchVo);
    }

    public List<Map> findByList(EquipmentDeviceSearchModel searchVo) {
        return baseMapper.findBySearchVo(searchVo);
    }

    /**
     * 添加 - 事务
     *
     * @param paramModel
     */
    @Transactional(rollbackFor = Exception.class)
    public void add(EquipmentDeviceAddParamModel paramModel) {

    }

    @Transactional(rollbackFor = Exception.class)
    public void edit(EquipmentDeviceEditParamModel paramModel) {

    }

    @Transactional(rollbackFor = Exception.class)
    public void dels(String[] ids) {
        baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    public void UpdType(String admitGuids) {
        baseMapper.UpdType(admitGuids);
    }

    public boolean delNO(String deviceNo) {
        return baseMapper.delNo(deviceNo);
    }

    public MonthlyModel monthly(String deviceNo) {

        return baseMapper.monthly(deviceNo);
    }

    public MonthlyModel day(String deviceNo) {

        return baseMapper.day(deviceNo);
    }
}